﻿namespace TfsExtensions.Build.Helper
{
    using System.Windows.Forms;

    /// <summary>
    /// Provide static methods to help UI related work.
    /// </summary>
    public static class MessageBoxHelper
    {
        #region Public Methods

        /// <summary>
        /// Shows the message.
        /// </summary>
        /// <param name="sender">The Message box sender.</param>
        /// <param name="text">The Message box text.</param>
        /// <param name="caption">The caption.</param>
        /// <returns>Dialog Result</returns>
        public static DialogResult ShowMessage(IWin32Window sender, string text, string caption)
        {
            return RightToLeftAwareMessageBox.Show(
                                                    sender,
                                                    text, 
                                                    caption, 
                                                    MessageBoxButtons.OK,
                                                    MessageBoxIcon.Information, 
                                                    MessageBoxDefaultButton.Button1, 
                                                    0);
        }

        /// <summary>
        /// Shows the error.
        /// </summary>
        /// <param name="sender">The message sender.</param>
        /// <param name="text">The Error text.</param>
        /// <param name="caption">The caption.</param>
        /// <returns>Dialog Result</returns>
        public static DialogResult ShowError(IWin32Window sender, string text, string caption)
        {
            return RightToLeftAwareMessageBox.Show(
                                                    sender, 
                                                    text, 
                                                    caption, 
                                                    MessageBoxButtons.OK,
                                                    MessageBoxIcon.Error,
                                                    MessageBoxDefaultButton.Button1, 
                                                    0);
        }

        /// <summary>
        /// Shows the warning.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="text">The Warning text.</param>
        /// <param name="caption">The caption.</param>
        /// <returns>Dialog Result</returns>
        public static DialogResult ShowWarning(IWin32Window sender, string text, string caption)
        {
            return RightToLeftAwareMessageBox.Show(
                                        sender,
                                        text, 
                                        caption, 
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information, 
                                        MessageBoxDefaultButton.Button1, 
                                        0);
        }

        /// <summary>
        /// Shows the question.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="text">The Question text.</param>
        /// <param name="caption">The caption.</param>
        /// <returns>Dialog Result</returns>
        public static DialogResult ShowQuestion(IWin32Window sender, string text, string caption)
        {
            return RightToLeftAwareMessageBox.Show(
                                                sender, 
                                                text, 
                                                caption, 
                                                MessageBoxButtons.YesNo,
                                                MessageBoxIcon.Question, 
                                                MessageBoxDefaultButton.Button1, 
                                                0);
        }

        #endregion
    }
}